#include <iostream>
#include <fstream>
#include <map>

#include "common.h"
#include "dumpfile.h"

using namespace std;

static map<string, Iu32> symbol_table;

bool Sym_Load(const string& path)
{
    symbol_table.clear();

    string name;
    Iu32 address;
    ifstream fdump(path.c_str(), ios_base::in);
    while(fdump>>name>>hex>>address) {
        //cout<<name<<hex<<address<<endl;
        symbol_table[name] = address;
    }

    return true;    
}

Iu32 Sym_SymbolToAddr(const string& name)
{
    Iu32 address = 0;
    if( symbol_table.find(name) != symbol_table.end() ) {
        address = symbol_table[name];
    }
    return address;
}
